<template>
	<view class="p-l-30 p-r-30">
		<view class="discounts-content p-t-15 p-b-16 m-t-30  " >
			<view class="top-content flex">
				<view class="top-content-left flex-content">
				<view class="">
					
			
					<view class="flex-content">
						
						<view class="xs p-t-30" v-if="item.condition_type!=2">
							￥
						</view>
						<view class="f-s-80 bold">
							{{item.money}}
						</view>
						<view class="xxl bold p-t-20" v-if="item.condition_type==2">折</view>
					</view>
					<view class="xs text-alcenter">
						{{item.coupon_name}}
					</view>
						</view>
				</view> 
				<view class="top-content-right flex col-center">
					
					<view class="">
						
				
					<view class="flex m-l-24">
						<view class="tip-btn xs flex-content">
							{{item.condition_type_name}}
						</view>
						<view class="sm m-l-12">
							{{item.condition_type_desc}}
						</view>
					</view>
					<view class="flex m-l-24 col-center m-t-10" >
						<view class="xxs" style="color: #999999 ;width: 262rpx;">
							{{item.send_time_start||item.use_time_start}}至{{item.send_time_end||item.use_time_end}}
						</view>
						<view class="" v-if="type==1">
							
					
						<view class="user-btn xs flex-content m-r-30"  v-if="item.is_get==0"  @click="setCoupon" >
							立即领取
						</view>
						<view class="user-btn xs flex-content m-r-30"  style="background-color: #9e9e9e;"   v-else   >
							已领取
						</view>
							</view>
							<view class="" v-if="type==2&&item.condition_type!=3&&money>=item.condition_money">
								
										<view class="" v-if="item.id!=couponid">		
							<view class="user-btn xs flex-content m-r-30" v-if="item.use_type==1||item.use_type==cartype"    @click="usercopid(item)" >
								立即使用
							</view>
							
								
							</view>
							<view class="user-btn xs flex-content m-r-30"  style="background-color: #9e9e9e;"   v-else   >
								现用卷
							</view>
								</view>
					</view>
				</view>
				
			</view>
				</view>
				<view class="flex-content xs m-t-10">
					无门槛{{item.condition_type_name}}---{{item.use_car_name}}
				</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"discounts-list",
		props:{
			item:{
				type:Object,
				default:()=>{}
			},
			index:{
				type:Number,
				default:0
			},
			type:{
				type:String,
				default:''
			},
			couponid:{
				type:String,
				default:""
			},
			cartype:{
				type:String,
				default:""
			},
			money:{
				type:Number,
				default:0
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			usercopid(item){
				if(this.cartype==2){
					uni.setStorageSync("onecopon",item.id)
				}else if(this.cartype==3){
					uni.setStorageSync("twocopon",item.id)
				}
				uni.navigateBack({
					
				})
			},
			setCoupon(){
				this.$emit("setCoupon",{
					id:this.item.id,
					index:this.index
				})
			}
		}
	}
</script>

<style lang="scss" scoped>

	.top-content-right{
		width: 500rpx;
		
		  border-bottom: 2rpx dotted  #EBC4C4;
		  height: 190rpx ;
	}
	.discounts-content{
		border-radius: 20rpx;
		background-color: #FFFFFF;
		overflow: hidden;
		height: 266rpx;
		width: 100%;
		}
		.top-content{
			height: 190rpx ;
				}
			.top-content-left{
			  width: 246rpx;
			  height: 190rpx ;
			 border-right: 2rpx dotted  #EBC4C4;
			  border-bottom: 2rpx dotted  #EBC4C4;
			}
	.tip-btn{
		background-color: #F6390D ;
		height: 32rpx;
		width: 100rpx;
		color: #FFFFFF;
	}
	.user-btn{
		border-radius: 130rpx;
		margin-left: 60rpx;
		width: 130rpx;
		height: 60rpx;
		background-color: #F6390D ;
		color: #FFFFFF;
	}
</style>
